package genetic_algorithm;

import java.util.ArrayList;

/**
 * interface for a Genetic Algorithm
 */
public interface GA
{
	/**
	 * this function initiate the first population of chromosomes with random values
	 * @param size - the population size
	 * @return - the first population
	 */
	public ArrayList<Chromosome> initiate_population(int size);
	
	/**
	 * this function selects the parents for the crossover operation
	 * @param population - the current population
	 * @param avg - the average fitness of the population
	 * @return - the selected parents for the crossover
	 */
	public ArrayList<Chromosome> selection(ArrayList<Chromosome> population,double avg);
	
	/**
	 * this function returns two children from the reproduction of parent1 and parent2
	 * @param parent1 - the first parent chromosome
	 * @param parent2 - the second parent chromosome
	 * @return - the two children of this parents
	 */
	public ArrayList<Chromosome> crossover(Chromosome parent1,Chromosome parent2);
	
	/**
	 * this function randomly changes chrm at certain probability
	 * @param chrm - the chromosome to change (maybe)
	 * @return - the chromosme after the change
	 */
	public Chromosome mutation(Chromosome chrm);
	
}
